import request from '@/utils/request'

// 查询教师列表
export function listTeacher(query) {
  return request({
    url: '/system/teacher/list',
    method: 'get',
    params: query
  })
}

// 查询教师详细
export function getTeacher(teacherId) {
  return request({
    url: '/system/teacher/' + teacherId,
    method: 'get'
  })
}

// 新增教师
export function addTeacher(data) {
  return request({
    url: '/system/teacher',
    method: 'post',
    data: data
  })
}

// 修改教师
export function updateTeacher(data) {
  return request({
    url: '/system/teacher',
    method: 'put',
    data: data
  })
}

// 删除教师
export function delTeacher(teacherId) {
  return request({
    url: '/system/teacher/' + teacherId,
    method: 'delete'
  })
}

// 绑定班级
export function bindClass(teacherId, classIds) {
  console.log('classIds---', classIds);
  if(!classIds) {
    classIds = [0];
  }
  return request({
    url: '/system/teacher/' + teacherId + '/bind-class/' + classIds,
    method: 'post'
  })
}

// 解绑班级
export function unbindClass(teacherId, classId) {
  return request({
    url: '/system/teacher/' + teacherId + '/unbind-class/' + classId,
    method: 'delete'
  })
}

// 查询班级列表
export function listClassUnBind(query) {
  return request({
    url: '/system/teacher/listClassUnBind',
    method: 'get',
    params: query
  })
}
